Remove the characters which have odd indexΒΆ
Remove the characters which have odd index values of a given string.
def odd_values_string(S):
result = ""
for i in range(len(S)):
if i % 2 == 0:
result = result + S[i]
return result
# test
print(odd_values_string('abcdef')) # ace
print(odd_values_string('python')) # pto